| regular expression The regular expression object can be likened to one instance of the regExp object. The regular Expression object is used for pattern matching. That is, you may look for say, a word within a document. A regular expression object is usually created by declaring a new variable with the value enclosed in forward slashes, as in the example below: var variableName = /text/ The variable can then be used within a script to find matches to whatever pattern you have a need to find. The regular expresion object need not be used only as a variable - it may be used as the parameter to a method. There are also a number of 'switches', called Regular Expression Notation, which may be used to further refine your search. These switches are given after the pattern, and are enclosed within square brackets. Each switch is within quotes and separated by a vertical bar. Examine the table below for a full list of switches available. Regular Expression Notation b Word Boundary B Non-Word Boundary d Numerals, 0 through to 9 D Non-Numeral g Global Search On i Ignore Capitals (Case) s Single WhiteSpace S Single Non-WhiteSpace w Letter, Numeral, or UnderScore W NOT a Letter, Numeral, or UnderScore . (period) Any Character, except a new line [ ... ] Any of the charater sets in the square brackets [^...] Negated Character Set * Zero or More Times ? Zero or One Time + One or More Times {n} Exactly 'n' Times {n, ] 'n' or More Times {n, m} At Least 'n' Times, and at Most 'm' Times ^ At the Beginning of a String or Line $ At the End of a String or Line syntax: var variableName = /string/ [ "vertical bar delimited switches" ] EXAMPLE var searchString = /big/ [ "^" | "{8, 10}" ] The example is looking for the string 'big' (a word, as is most common), at the beginning of a string or line, at least 8 times but no more than ten times. The Properties of Regular Expression are: • global • ignoreCase • lastIndex • source The Methods of Regular Expression are: • compile() • exec() • test() |